--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  C:/Users/agerster/Dropbox/Projekt_Gebaeudeausweis/Auswertung JAERE_final/log/2019_6_5_descriptive_statistics.log
  log type:  text
 opened on:   5 Jun 2019, 14:33:44

. 
. 
. ************** 
. **************
. * Descriptive Statistics
. **************
. **************
. 
. * recode variables
. replace kaufpreis = kaufpreis/1000
(350,749 real changes made)

. replace rentner_anteil_plz = rentner_anteil/100
(348,959 real changes made)

. replace auslaender_anteil_plz = auslaender_anteil_plz/100
(348,944 real changes made)

. 
. 
. 
. ** Table 2 (descriptives for EPC = 1 und EPC = 0)
. *********************************************************
. global descvars_results kaufpreis duration wohnflaeche grundflaeche zimmer_cont alter modernvor mfh efm rowhouse qu_simple qu_normal qu_superior zus_renov zus_good h_central h_etag
> e h_oven b_oil b_gas b_elec b_others banks eagents private evk

. 
. 
. * EPC = 1
. quietly tabstat $descvars_results if epc == 1, save stats(mean sd N)

. 
. mat aux = r(StatTotal)

. mat results = aux'

. matrix rownames results = $descvars_results

. matrix colnames results = mean sd n

. matrix together = results

. 
. cap matrix drop results aux

. cap matrix drop export 

. 
. * EPC = 0
. quietly tabstat $descvars_results if epc == 0, save stats(mean sd N)

. 
. mat aux = r(StatTotal)

. mat results = aux'

. matrix rownames results = $descvars_results

. matrix colnames results = mean sd n

. matrix together = together, results

. 
. cap matrix drop results aux

. cap matrix drop export 

.  
. 
. ** export to latex
. estout matrix(together, fmt( ///
>         "%11.1fc %11.1fc %11.1fc %11.1fc %11.1fc %11.1fc %11.1fc 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 %11.1fc" ///
>         "%11.1fc %11.1fc %11.1fc %11.1fc %11.1fc %11.1fc %11.1fc 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 %11.1fc" ///
>         "%11.0fc " ///
>         "%11.1fc %11.1fc %11.1fc %11.1fc %11.1fc %11.1fc %11.1fc 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 %11.1fc" ///
>         "%11.1fc %11.1fc %11.1fc %11.1fc %11.1fc %11.1fc %11.1fc 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 %11.1fc" ///
>         "%11.0fc " ///  
> )), // style(tex)

------------------------------------------------------------------------------------------
                 together                                                                 
                     mean           sd            n         mean           sd            n
------------------------------------------------------------------------------------------
kaufpreis           270.8        157.7      127,434        238.5        148.8      223,315
duration              5.4          6.4      127,434          6.6          9.2      223,315
wohnflaeche         165.6         67.8      127,434        165.6         70.0      223,315
grundflaeche        729.1        594.0      127,434        757.2        642.9      223,315
zimmer_cont           6.1          2.5      127,434          6.1          2.6      223,315
alter                45.6         27.8      127,434         48.0         29.4      223,315
modernvor             9.0          9.0       37,677          8.8          9.1       49,697
mfh                  0.16         0.36      118,553         0.15         0.36      192,209
efm                  0.55         0.50      118,553         0.57         0.50      192,209
rowhouse             0.29         0.46      118,553         0.28         0.45      192,209
qu_simple            0.09         0.28       47,296         0.12         0.32       80,698
qu_normal            0.51         0.50       47,296         0.52         0.50       80,698
qu_superior          0.40         0.49       47,296         0.37         0.48       80,698
zus_renov            0.15         0.35       89,913         0.19         0.39      138,385
zus_good             0.85         0.35       89,913         0.81         0.39      138,385
h_central            0.93         0.25       89,765         0.92         0.28      142,086
h_etage              0.04         0.19       89,765         0.04         0.21      142,086
h_oven               0.03         0.18       89,765         0.04         0.19      142,086
b_oil                0.34         0.47      108,319         0.35         0.48      142,546
b_gas                0.55         0.50      108,319         0.56         0.50      142,546
b_elec               0.05         0.22      108,319         0.04         0.20      142,546
b_others             0.05         0.22      108,319         0.04         0.20      142,546
banks                0.34         0.48      127,434         0.24         0.43      223,315
eagents              0.60         0.49      127,434         0.66         0.47      223,315
private              0.06         0.23      127,434         0.10         0.30      223,315
evk                 172.9         83.7      127,434            .            .            0
------------------------------------------------------------------------------------------

. 
.  
.  
.  
. 
. ** Table 3 (Online Appendix E) 
. ******************************************************************
.  
. global descvars_results kaufpreis duration wohnflaeche grundflaeche zimmer_cont alter modernvor mfh efm rowhouse qu_simple qu_normal qu_superior zus_renov zus_good h_central h_etag
> e h_oven b_oil b_gas b_elec b_others banks eagents private epc evk

. global descvars_regional dichte_plz kaufkraft_pk_plz rentner_anteil_plz auslaender_anteil_plz

. 
. 
. * Multlist = 1
. quietly tabstat $descvars_results $descvars_regional if multlist == 1, save stats(mean sd N)

. 
. mat aux = r(StatTotal)

. mat results = aux'

. matrix rownames results = $descvars_results $descvars_regional

. matrix colnames results = mean sd n

. matrix together = results

.         
. cap matrix drop results aux

. cap matrix drop export 

. 
. 
. * Multlist = 0
. quietly tabstat $descvars_results $descvars_regional if multlist == 0, save stats(mean sd N)

. 
. mat aux = r(StatTotal)

. mat results = aux'

. matrix rownames results = $descvars_results $descvars_regional

. matrix colnames results = mean sd n

. matrix together = together, results

. 
. 
. ** Further statistics (T-Tests and standardized bias)
. 
. scalar rowcount = wordcount("$descvars_results $descvars_regional")

. mat statistic = J(rowcount,1,.)

. 
. local count = 1

. foreach var of varlist $descvars_results $descvars_regional {
  2.         * normalized difference
.         quietly sum `var' if multlist == 1
  3.         scalar mean1 = r(mean)
  4.         scalar sd1 = r(sd)
  5.         quietly sum `var' if multlist == 0
  6.         scalar mean0 = r(mean)
  7.         scalar sd0 = r(sd)
  8.         
.         mat statistic[`count',1] =  ((mean1 - mean0)/(sqrt((sd1^2+sd0^2)/2)))*100
  9.         matrix rownames statistic = $descvars_results $descvars_regional
 10.         local count = `count' + 1
 11. }

. 
. matrix together = together, statistic

. 
. ** export to latex
. estout matrix(together, fmt( ///
>         "%11.1fc %11.1fc %11.1fc %11.1fc %11.1fc %11.1fc %11.1fc 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 %11.1fc %11.1fc %11.1fc 2 2" ///
>         "%11.1fc %11.1fc %11.1fc %11.1fc %11.1fc %11.1fc %11.1fc 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 %11.1fc %11.1fc %11.1fc 2 2" ///
>         "%11.0fc " ///
>         "%11.1fc %11.1fc %11.1fc %11.1fc %11.1fc %11.1fc %11.1fc 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 %11.1fc %11.1fc %11.1fc 2 2" ///
>         "%11.1fc %11.1fc %11.1fc %11.1fc %11.1fc %11.1fc %11.1fc 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 %11.1fc %11.1fc %11.1fc 2 2" ///
>         "%11.0fc " ///
>         "%11.1fc " ///  
> )), // style(tex)

-------------------------------------------------------------------------------------------------------
                 together                                                                              
                     mean           sd            n         mean           sd            n           c1
-------------------------------------------------------------------------------------------------------
kaufpreis           251.2        161.9       65,486        250.0        150.7      285,263          0.8
duration              7.2          5.9       65,486          5.9          8.8      285,263         17.4
wohnflaeche         172.1         72.4       65,486        164.1         68.3      285,263         11.4
grundflaeche        784.2        663.0       65,486        738.5        616.5      285,263          7.1
zimmer_cont           6.2          2.6       65,486          6.1          2.5      285,263          2.8
alter                48.3         29.9       65,486         46.9         28.6      285,263          5.1
modernvor             8.8          8.7       12,285          8.9          9.1       75,089         -1.1
mfh                  0.16         0.37       51,440         0.15         0.36      259,322          4.0
efm                  0.58         0.49       51,440         0.56         0.50      259,322          5.0
rowhouse             0.25         0.44       51,440         0.29         0.46      259,322         -8.8
qu_simple            0.10         0.30       19,813         0.11         0.31      108,181         -1.6
qu_normal            0.52         0.50       19,813         0.52         0.50      108,181         -0.1
qu_superior          0.38         0.49       19,813         0.38         0.48      108,181          1.1
zus_renov            0.16         0.37       37,983         0.18         0.38      190,315         -3.3
zus_good             0.84         0.37       37,983         0.82         0.38      190,315          3.3
h_central            0.92         0.26       40,005         0.92         0.27      191,846          1.1
h_etage              0.04         0.20       40,005         0.04         0.20      191,846         -0.7
h_oven               0.03         0.18       40,005         0.04         0.19      191,846         -0.8
b_oil                0.36         0.48       39,476         0.35         0.48      211,389          1.6
b_gas                0.56         0.50       39,476         0.56         0.50      211,389         -0.5
b_elec               0.05         0.21       39,476         0.05         0.21      211,389          0.2
b_others             0.04         0.20       39,476         0.05         0.21      211,389         -2.8
banks                0.18         0.38       65,486         0.30         0.46      285,263        -29.2
eagents              0.82         0.38       65,486         0.59         0.49      285,263         51.7
private              0.00         0.00       65,486         0.10         0.31      285,263        -48.3
epc                  0.33         0.47       65,486         0.37         0.48      285,263         -9.8
evk                 168.8         80.8       21,307        173.7         84.2      106,127         -5.8
dichte_plz          725.9      1,049.8       65,186        735.5      1,058.2      283,773         -0.9
kaufkraft_~z         21.3          3.2       65,186         21.4          3.0      283,773         -0.9
rentner_an~z         0.21         0.03       65,186         0.21         0.03      283,773          1.7
auslaender~z         0.06         0.04       65,186         0.06         0.04      283,773         -2.2
-------------------------------------------------------------------------------------------------------

. 
. 
. 
. ** Table 4 (Online Appendix F): Number of Sales on Immobilienscout in 2013 and 2015 across Seller Types
. ***************************************************     
. 
. bysort anid: egen objekts_anid = count(anid)

. egen tag_anid = tag(anid)

. 
. foreach agent in banks eagents private {
  2.         tabstat objekts_anid if tag_anid & `agent', stats(sum N mean sd p10 p90) save
  3.         mat `agent'_results = r(StatTotal)
  4. }

    variable |       sum         N      mean        sd       p10       p90
-------------+------------------------------------------------------------
objekts_anid |     97695      2290  42.66157  110.5614         1     105.5
--------------------------------------------------------------------------

    variable |       sum         N      mean        sd       p10       p90
-------------+------------------------------------------------------------
objekts_anid |    223300     21926  10.18426  82.68283         1        22
--------------------------------------------------------------------------

    variable |       sum         N      mean        sd       p10       p90
-------------+------------------------------------------------------------
objekts_anid |     29754     28868  1.030691  .2882683         1         1
--------------------------------------------------------------------------

. 
. mat results = (banks_results, eagents_results, private_results) 

. mat colnames results = banks eagents private    

.         
.         
. estout matrix(results, fmt( ///
>         "%11.0fc %11.0fc %11.1fc %11.1fc %11.0fc %11.0fc" ///
>         "%11.0fc %11.0fc %11.1fc %11.1fc %11.0fc %11.0fc" ///
>         "%11.0fc %11.0fc %11.1fc %11.1fc %11.0fc %11.0fc" ///
> )), // style(tex)

---------------------------------------------------
                  results                          
                    banks      eagents      private
---------------------------------------------------
sum                97,695      223,300       29,754
N                   2,290       21,926       28,868
mean                 42.7         10.2          1.0
sd                  110.6         82.7          0.3
p10                     1            1            1
p90                   106           22            1
---------------------------------------------------

. 
.         
.         
. ** Table 5 (Online Appendix F): Differences in Characteristics, by Seller Type
. ******************************************************************      
. global descvars_results kaufpreis duration wohnflaeche grundflaeche zimmer_cont alter modernvor mfh efm rowhouse qu_simple qu_normal qu_superior zus_renov zus_good h_central h_etag
> e h_oven b_oil b_gas b_elec b_others epc evk

. global descvars_regional dichte_plz kaufkraft_pk_plz rentner_anteil_plz auslaender_anteil_plz

.         
.         
. ** banks
. quietly tabstat $descvars_results $descvars_regional if banks == 1, save stats(mean)

. 
. mat aux = r(StatTotal)

. mat results = aux'

. matrix rownames results = $descvars_results $descvars_regional

. matrix colnames results = mean

. matrix together = results

. 
. cap matrix drop results aux

. cap matrix drop export 

.         
.         
. ** eagents
. quietly tabstat $descvars_results $descvars_regional if eagents == 1, save stats(mean)

. 
. mat aux = r(StatTotal)

. mat results = aux'

. matrix rownames results = $descvars_results $descvars_regional

. matrix colnames results = mean

. matrix together = together, results

.         
. cap matrix drop results aux

. cap matrix drop export 

.         
. 
. ** private
. quietly tabstat $descvars_results $descvars_regional if private == 1, save stats(mean)

. 
. mat aux = r(StatTotal)

. mat results = aux'

. matrix rownames results = $descvars_results $descvars_regional

. matrix colnames results = mean

. matrix together = together, results

. 
. cap matrix drop results aux

. cap matrix drop export 

.         
.                 
. ** Further statistics: Standardized Bias banks eagents
. 
. scalar rowcount = wordcount("$descvars_results $descvars_regional")

. mat statistic = J(rowcount,1,.)

. 
. local count = 1

. foreach var of varlist $descvars_results $descvars_regional {
  2. 
.         * normalized difference
.         quietly sum `var' if banks == 1
  3.         scalar mean1 = r(mean)
  4.         scalar sd1 = r(sd)
  5.         quietly sum `var' if eagents == 1
  6.         scalar mean0 = r(mean)
  7.         scalar sd0 = r(sd)
  8.         
.         mat statistic[`count',1] =  ((mean1 - mean0)/(sqrt((sd1^2+sd0^2)/2)))*100
  9.         matrix rownames statistic = $descvars_results $descvars_regional
 10.         local count = `count' + 1
 11. }

. 
. matrix together = together, statistic

. 
. ** Further statistics: Standardized Bias banks eagents
. 
. scalar rowcount = wordcount("$descvars_results $descvars_regional")

. mat statistic = J(rowcount,1,.)

. 
. local count = 1

. foreach var of varlist $descvars_results $descvars_regional {
  2.         * normalized difference
.         quietly sum `var' if eagents == 1
  3.         scalar mean1 = r(mean)
  4.         scalar sd1 = r(sd)
  5.         quietly sum `var' if private == 1
  6.         scalar mean0 = r(mean)
  7.         scalar sd0 = r(sd)
  8.         
.         mat statistic[`count',1] =  ((mean1 - mean0)/(sqrt((sd1^2+sd0^2)/2)))*100
  9.         matrix rownames statistic = $descvars_results $descvars_regional
 10.         local count = `count' + 1
 11. }

. 
. matrix together = together, statistic

. 
. estout matrix(together, fmt( ///
>         "%11.1fc %11.1fc %11.1fc %11.1fc %11.1fc %11.1fc %11.1fc 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 %11.1fc %11.1fc %11.1fc 2 2" ///
>         "%11.1fc %11.1fc %11.1fc %11.1fc %11.1fc %11.1fc %11.1fc 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 %11.1fc %11.1fc %11.1fc 2 2" ///       
>         "%11.1fc %11.1fc %11.1fc %11.1fc %11.1fc %11.1fc %11.1fc 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 %11.1fc %11.1fc %11.1fc 2 2" ///       
>         %11.1fc ///
>         %11.1fc ///
>         )), // style(tex)

-----------------------------------------------------------------------------
                 together                                                    
                     mean         mean         mean           c1           c1
-----------------------------------------------------------------------------
kaufpreis           214.4        262.5        275.5        -33.0         -8.6
duration              5.8          6.5          4.9         -9.6         19.6
wohnflaeche         156.7        170.0        162.0        -19.5         11.9
grundflaeche        755.8        753.6        668.7          0.4         14.2
zimmer_cont           5.9          6.2          6.3         -9.1         -4.8
alter                49.9         46.7         41.4         11.3         18.6
modernvor            11.2          8.7          7.1         26.6         18.2
mfh                  0.17         0.15         0.11          4.4         12.9
efm                  0.57         0.56         0.51          2.8         10.5
rowhouse             0.26         0.29         0.38         -6.7        -20.3
qu_simple            0.16         0.11         0.06         14.5         17.0
qu_normal            0.59         0.52         0.46         12.9         11.9
qu_superior          0.25         0.37         0.47        -24.6        -21.8
zus_renov            0.22         0.17         0.11         14.1         15.4
zus_good             0.78         0.83         0.89        -14.1        -15.4
h_central            0.92         0.92         0.93         -1.8         -3.7
h_etage              0.03         0.05         0.04         -6.0          1.9
h_oven               0.05         0.03         0.03          8.6          3.4
b_oil                0.38         0.34         0.32          9.7          4.5
b_gas                0.51         0.57         0.58        -12.0         -2.1
b_elec               0.06         0.04         0.04          6.5          3.5
b_others             0.04         0.04         0.06         -0.5         -7.8
epc                  0.45         0.34         0.24         22.3         21.8
evk                 190.1        165.8        142.2         28.8         30.6
dichte_plz          582.5        791.1        801.5        -20.8         -1.0
kaufkraft_~z         20.9         21.5         21.7        -19.3         -6.1
rentner_an~z         0.21         0.21         0.21         -0.6          5.6
auslaender~z         0.06         0.06         0.07        -12.8         -5.5
-----------------------------------------------------------------------------

. 
. 
. if ($LOGTIME == 1) log close    
      name:  <unnamed>
       log:  C:/Users/agerster/Dropbox/Projekt_Gebaeudeausweis/Auswertung JAERE_final/log/2019_6_5_descriptive_statistics.log
  log type:  text
 closed on:   5 Jun 2019, 14:33:54
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
